package com.bawei.exam57.utils

import android.content.Context
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.annotation.Interceptor
import com.alibaba.android.arouter.facade.callback.InterceptorCallback
import com.alibaba.android.arouter.facade.template.IInterceptor
import com.blankj.utilcode.util.SPUtils
import com.blankj.utilcode.util.ToastUtils

@Interceptor(priority = 1)
class TokenARouter:IInterceptor {
    override fun init(context: Context?) {

    }

    override fun process(postcard: Postcard?, callback: InterceptorCallback?) {
        if (SPUtils.getInstance().getString("token").isNotEmpty()){
//            通过
            callback?.onContinue(postcard)
        }else{
            ToastUtils.showLong("请先登录")
        }
    }

}